<template>
  <div class="list">
    <article-item v-for="(item, idx) in listData" :key="idx" :inst="item" />
  </div>
</template>

<script setup lang="ts">
import articleItem from '@/components/articleItem.vue'
import { get } from '@/util/request.js'
import { onMounted, ref } from 'vue'
import { useRoute } from "vue-router"

const listData = ref([])

onMounted(() => {
  const route = useRoute()
  const id = parseInt(route.query.id)
  getData(id)
})

const getData = (id: number) => {
  get('/tag/get-articles?id=' + id).then(
    (resp) => {
      listData.value = resp.inst.Articles
    }
  )
}

</script>
